Skip to content

test: add unit tests for ActiveStreamingTool and ReadonlyContext#464

Open
nuthalapativarun wants to merge 2 commits into
google:mainfrom
nuthalapativarun:test/unit-tests-active-streaming-oauth2-readonly
Open

test: add unit tests for ActiveStreamingTool and ReadonlyContext#464
nuthalapativarun wants to merge 2 commits into
google:mainfrom
nuthalapativarun:test/unit-tests-active-streaming-oauth2-readonly

Conversation

@nuthalapativarun

Copy link
Copy Markdown
Contributor

Problem

Two classes in core/src/agents/ have no unit test coverage:

  • ActiveStreamingTool (active_streaming_tool.ts)
  • ReadonlyContext (readonly_context_test.ts)

Solution

Add unit tests for both classes:

active_streaming_tool_test.ts — 5 tests covering:

  • Constructor with no params (both task and stream are undefined)
  • Constructor with only task set
  • Constructor with only stream set
  • Constructor with both params
  • Field reads after construction (including instanceof LiveRequestQueue check)

readonly_context_test.ts — 9 tests covering:

  • Constructor instantiation with minimal InvocationContext mock
  • Each getter (invocationId, userId, sessionId, agentName, userContent) delegates correctly
  • userContent is undefined when not set
  • state returns a State wrapping the session state values
  • state returns a new State instance on each access

Testing

✓ core/test/agents/active_streaming_tool_test.ts (5 tests)
✓ core/test/agents/readonly_context_test.ts (9 tests)

All 2209 existing tests continue to pass. The 2 pre-existing failures (database_session_service_test.ts timeout) are unrelated to this change.

Checklist

  • I have performed a self-review of my code
  • Tests added and passing
  • Manual E2E verified (N/A — test-only change)

@@ -0,0 +1,117 @@
/**
* @license
* Copyright 2025 Google LLC

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2026

@@ -0,0 +1,51 @@
/**
* @license
* Copyright 2025 Google LLC

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2026

@nuthalapativarun

Copy link
Copy Markdown
Contributor Author

Hi team — following up on PR #464 (unit tests for ActiveStreamingTool and ReadonlyContext, 14 tests). Mergeable. Happy to address any feedback. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants